
// Correction constant value: 0 (000000000)

module ncm_arr_8881 (Z2, X, Y);
	
	input [7:0] Y;
	input [7:0] X;
	output [7:0] Z2;


	wire [7:0] P0;
	wire [7:0] carry1;
	wire [7:0] sum1;
	wire [7:0] P1;
	wire [7:0] carry2;
	wire [7:0] sum2;
	wire [7:0] P2;
	wire [7:0] carry3;
	wire [7:0] sum3;
	wire [7:0] P3;
	wire [7:0] carry4;
	wire [7:0] sum4;
	wire [7:0] P4;
	wire [7:0] carry5;
	wire [7:0] sum5;
	wire [7:0] P5;
	wire [7:0] carry6;
	wire [7:0] sum6;
	wire [7:0] P6;
	wire [7:0] carry7;
	wire [7:0] sum7;
	wire [7:0] P7;
	wire [7:0] carry8;
	wire [7:0] sum8;
	wire [7:0] carry9;
	wire [8:0] Z;


	// generate the partial products.
	and pp1(P0[7], X[7], Y[0]);
	and pp2(sum1[7], X[7], Y[1]);
	and pp3(P1[6], X[6], Y[1]);
	and pp4(sum2[7], X[7], Y[2]);
	and pp5(P2[6], X[6], Y[2]);
	and pp6(P2[5], X[5], Y[2]);
	and pp7(sum3[7], X[7], Y[3]);
	and pp8(P3[6], X[6], Y[3]);
	and pp9(P3[5], X[5], Y[3]);
	and pp10(P3[4], X[4], Y[3]);
	and pp11(sum4[7], X[7], Y[4]);
	and pp12(P4[6], X[6], Y[4]);
	and pp13(P4[5], X[5], Y[4]);
	and pp14(P4[4], X[4], Y[4]);
	and pp15(P4[3], X[3], Y[4]);
	and pp16(sum5[7], X[7], Y[5]);
	and pp17(P5[6], X[6], Y[5]);
	and pp18(P5[5], X[5], Y[5]);
	and pp19(P5[4], X[4], Y[5]);
	and pp20(P5[3], X[3], Y[5]);
	and pp21(P5[2], X[2], Y[5]);
	and pp22(sum6[7], X[7], Y[6]);
	and pp23(P6[6], X[6], Y[6]);
	and pp24(P6[5], X[5], Y[6]);
	and pp25(P6[4], X[4], Y[6]);
	and pp26(P6[3], X[3], Y[6]);
	and pp27(P6[2], X[2], Y[6]);
	and pp28(P6[1], X[1], Y[6]);
	and pp29(sum7[7], X[7], Y[7]);
	and pp30(P7[6], X[6], Y[7]);
	and pp31(P7[5], X[5], Y[7]);
	and pp32(P7[4], X[4], Y[7]);
	and pp33(P7[3], X[3], Y[7]);
	and pp34(P7[2], X[2], Y[7]);
	and pp35(P7[1], X[1], Y[7]);
	and pp36(P7[0], X[0], Y[7]);

	// Array Reduction
	half_adder  HA1(carry1[6],sum1[6],P1[6],P0[7]);
	full_adder  FA1(carry2[6],sum2[6],P2[6],sum1[7],carry1[6]);
	half_adder  HA2(carry2[5],sum2[5],P2[5],sum1[6]);
	full_adder  FA2(carry3[6],sum3[6],P3[6],sum2[7],carry2[6]);
	full_adder  FA3(carry3[5],sum3[5],P3[5],sum2[6],carry2[5]);
	half_adder  HA3(carry3[4],sum3[4],P3[4],sum2[5]);
	full_adder  FA4(carry4[6],sum4[6],P4[6],sum3[7],carry3[6]);
	full_adder  FA5(carry4[5],sum4[5],P4[5],sum3[6],carry3[5]);
	full_adder  FA6(carry4[4],sum4[4],P4[4],sum3[5],carry3[4]);
	half_adder  HA4(carry4[3],sum4[3],P4[3],sum3[4]);
	full_adder  FA7(carry5[6],sum5[6],P5[6],sum4[7],carry4[6]);
	full_adder  FA8(carry5[5],sum5[5],P5[5],sum4[6],carry4[5]);
	full_adder  FA9(carry5[4],sum5[4],P5[4],sum4[5],carry4[4]);
	full_adder  FA10(carry5[3],sum5[3],P5[3],sum4[4],carry4[3]);
	half_adder  HA5(carry5[2],sum5[2],P5[2],sum4[3]);
	full_adder  FA11(carry6[6],sum6[6],P6[6],sum5[7],carry5[6]);
	full_adder  FA12(carry6[5],sum6[5],P6[5],sum5[6],carry5[5]);
	full_adder  FA13(carry6[4],sum6[4],P6[4],sum5[5],carry5[4]);
	full_adder  FA14(carry6[3],sum6[3],P6[3],sum5[4],carry5[3]);
	full_adder  FA15(carry6[2],sum6[2],P6[2],sum5[3],carry5[2]);
	half_adder  HA6(carry6[1],sum6[1],P6[1],sum5[2]);
	full_adder  FA16(carry7[6],sum7[6],P7[6],sum6[7],carry6[6]);
	full_adder  FA17(carry7[5],sum7[5],P7[5],sum6[6],carry6[5]);
	full_adder  FA18(carry7[4],sum7[4],P7[4],sum6[5],carry6[4]);
	full_adder  FA19(carry7[3],sum7[3],P7[3],sum6[4],carry6[3]);
	full_adder  FA20(carry7[2],sum7[2],P7[2],sum6[3],carry6[2]);
	full_adder  FA21(carry7[1],sum7[1],P7[1],sum6[2],carry6[1]);
	assign carry7[0] = P7[0] & sum6[1];

	// Generate lower product bits YBITS 

	// Final Carry Propagate Addition
	//   Generate higher product bits
	half_adder CPA1(carry8[0],Z2[0],carry7[0],sum7[1]);
	full_adder CPA2(carry8[1],Z2[1],carry7[1],carry8[0],sum7[2]);
	full_adder CPA3(carry8[2],Z2[2],carry7[2],carry8[1],sum7[3]);
	full_adder CPA4(carry8[3],Z2[3],carry7[3],carry8[2],sum7[4]);
	full_adder CPA5(carry8[4],Z2[4],carry7[4],carry8[3],sum7[5]);
	full_adder CPA6(carry8[5],Z2[5],carry7[5],carry8[4],sum7[6]);
	full_adder CPA7(Z2[7],Z2[6],carry7[6],carry8[5],sum7[7]);
endmodule